# Contributor: Runar Tenfjord < runar dot tenfjord at gmail dot com >

_realname=pyparsing
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=2.0.3
pkgrel=2
pkgdesc='General parsing module for Python (mingw-w64)'
arch=('any')
url='http://pyparsing.wikispaces.com'
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-python3"
             "${MINGW_PACKAGE_PREFIX}-python2")
source=("https://downloads.sourceforge.net/pyparsing/pyparsing-${pkgver}.tar.gz")
sha256sums=('06e729e1cbf5274703b1f47b6135ed8335999d547f9d8cf048b210fb8ebf844f')

prepare() {
  cd "${srcdir}"
  cp -r pyparsing-${pkgver} python2-build
  cp -r pyparsing-${pkgver} python3-build
}

package_python3-pyparsing() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3")

  cd ${srcdir}/python3-build
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE"
}

package_python2-pyparsing() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2")

  cd ${srcdir}/python2-build
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
}

package_mingw-w64-i686-python2-pyparsing() {
  package_python2-pyparsing
}

package_mingw-w64-i686-python3-pyparsing() {
  package_python3-pyparsing
}

package_mingw-w64-x86_64-python2-pyparsing() {
  package_python2-pyparsing
}

package_mingw-w64-x86_64-python3-pyparsing() {
  package_python3-pyparsing
}
